local skill = fk.CreateSkill{
  name = "fire_attack_choose",
}

Fk:loadTranslationTable{ ["fire_attack_choose"] = "火攻" }

local I = require "packages/iberia/utility"

local all_choices = {"discard_skill", "lose_hp"}

skill:addEffect("active", {
  can_use = Util.FalseFunc,
  interaction = function (self, player)
    local choices = table.simpleClone(all_choices)
    if not I.isRepeller(player) then
      table.remove(choices, 2)
    end
    return UI.ComboBox { choices = choices, all_choices = all_choices }
  end,
  target_num = 0,
  card_filter = function (self, player, to_select, selected)
    if self.interaction.data == "discard_skill" then
      return #selected == 0 and Fk:getCardById(to_select).suit == self.fire_attack_suit
        and Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand and not player:prohibitDiscard(to_select)
    else
      return false
    end
  end,
  target_filter = Util.FalseFunc,
  feasible = function (self, player, selected, selected_cards)
    return self.interaction.data == all_choices[1] and #selected_cards == 1 or #selected_cards == 0
  end
})

return skill
